/* 8911106 302933981 Ofri Keidar */

/******************************************************************************
* Student Name: Ofri Keidar
* Exercise Name: Ex6
* File Description: Class NoItemError's implementation
******************************************************************************/


#include "NoItemError.h"

/***************************************************************************************
* function name: NoItemError(const short invalidItem)
* The Input: Invalid item number
* The output: None
* The Function operation: Initializes invalid number attribute with given value
***************************************************************************************/
NoItemError::NoItemError(const short invalidItem) {
	m_invalidItem = invalidItem;
}

/***************************************************************************************
* function name: NoItemError(const NoItemError& excpToCopy)
* The Input: NoItemError object to be copied
* The output: None
* The Function operation: Uses MyInventoryException's copy constructor
***************************************************************************************/
NoItemError::NoItemError(const NoItemError& excpToCopy) : MyInventoryException(excpToCopy) { }

/***************************************************************************************
* function name: const char* what()
* The Input: None
* The output: Error message
* The Function operation: Uses MyInventoryException's method in order to convert invalid
* 						  item to string, then composes error message, uses MyInventoryException's
* 						  method to convert the string to char* and returns it
***************************************************************************************/
const char* NoItemError::what() {
	string invalidItemStr = "Missing product number " + intToString(m_invalidItem);
	return stringToCharPtr(invalidItemStr);
}
